<template>
  <span>
    <el-form size="mini" :inline="true" :model="searchData">
      <el-form-item :span="16" label="xPath">
        <el-input v-model="searchData.likeStr" placeholder="xPath"></el-input>
      </el-form-item>
      <el-form-item :span="16" label="pool名字">
        <el-input
          v-model="searchData.poolName"
          placeholder="pool名字"
        ></el-input>
      </el-form-item>
      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          @click="search"
        ></el-button>
      </el-form-item>
    </el-form>
    <el-table border :data="dataList" style="width: 100%">
      <el-table-column type="expand">
        <template slot-scope="props">
          <el-form label-position="left" inline class="demo-table-expand">
            <el-form-item label="pool名字">
              <span>{{ props.row.poolName }}</span>
            </el-form-item>
            <el-form-item label="类名">
              <span>{{ props.row.className }}</span>
            </el-form-item>
            <el-form-item label="方法名">
              <span>{{ props.row.methodName }}</span>
            </el-form-item>
            <el-form-item label="http">
              <span>{{ props.row.restfulUrl }}</span>
            </el-form-item>
          </el-form>
        </template>
      </el-table-column>
      <el-table-column label="pool名" prop="poolName"> </el-table-column>
      <el-table-column label="类名" prop="className"> </el-table-column>
      <el-table-column label="方法名" prop="methodName"> </el-table-column>
      <el-table-column label="类型" prop="type"> </el-table-column>
      <el-table-column label="层" prop="layer"> </el-table-column>
      <el-table-column label="描述" prop="name"> </el-table-column>
      <el-table-column label="备注" prop="remarks"> </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="danger"
            @click="$r_to({ name: 'flow', params: { id: scope.row.id }})"
            >查看流程</el-button
          >

          <el-button
            size="mini"
            type="danger"
            @click="$r_to({ name: 'relation', params: { id: scope.row.id }})"
            >查看引用</el-button
          >
        </template>
      </el-table-column>
    </el-table>
  </span>
</template>

<script>
  export default {
    name: 'list',
    data() {
      return {
        dataList: [],
        searchData: {
          likeStr: null,
          poolName: null,
          rows: 20
        }
      };
    },
    created() {
      this.search();
    },
    methods: {
      search() {
        this.$http({
          url: '/grap/searchByList',
          method: 'get',
          params: this.$http.adornParams(this.searchData)
        }).then(({ data }) => {
          this.dataList = data;
        });
      }
    }
  };
</script>
